using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Iori.FileManageLib;

namespace WuLongAssistance {
    public partial class WordListView : Form {
        private List<WuLongItem> WuLongItemList_;


        public WordListView(List<WuLongItem> pWuLongItemList) {
            InitializeComponent();

            ReLoad(pWuLongItemList);
        }

        public void ReLoad(List<WuLongItem> pWuLongItemList) {
            if (pWuLongItemList != null) {
                WuLongItemList_ = pWuLongItemList;
                lbMain.Items.Clear();
                lbMain.Items.AddRange(pWuLongItemList.ToArray());
                if (pWuLongItemList.Count > 0) {
                    lbMain.SelectedIndex = 0;
                }
            }
        }

        private void lbMain_SelectedIndexChanged(object sender, EventArgs e) {
            if (lbMain.SelectedIndex != -1) {
                wvMain.WordShow = lbMain.SelectedItem as WuLongItem;
            }
        }
    }
}